<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //// 作业：通过数组解构拿出来这个人的信息（要求用俩变量解构完毕），
      // ['张三',{uname:'张三',age:18,address:'杭州'},{uname:'李四',age:20,address:'上海'}]
      // 通过解构出来的数据第一个名字 找出这个人的全部信息 打印出来

      const arr = [
        '张三',
        { uname: '张三', age: 18, address: '杭州' },
        { uname: '李四', age: 20, address: '上海' },
      ]

      const [a, ...dian] = arr
      console.log(a)
      console.log(dian)

      let arr1 = []
      for (let i = 0; i < dian.length; i++) {
        // console.log(dian[i]);
        if (dian[i].uname === a) {
          arr1.push(dian[i])
        }
      }
      console.log(arr1)
      console.log('jzh');
    </script>
  </body>
</html>
